var IP = "192.168.105.79";
var ws20 = new ReconnectingWebSocket("ws://" + IP + ":1884/ws/OP20");
ws20.onmessage = function (e) {

    var obj = JSON.parse(e.data);
    if(typeof(robot)!='undefined'){
        robot.joints.joint_z.position.z = obj[0];
        $('#j2').html(obj[0].toFixed(2));
    }

};

var ws10 = new ReconnectingWebSocket("ws://" + IP + ":1884/ws/OP10");
ws10.onmessage = function (e) {

    var obj = JSON.parse(e.data);
    if(typeof(robot)!='undefined'){
        robot.joints.joint_r.rotation.z = obj[0];
        $('#j1').html(obj[0].toFixed(2));
    }
};

var ws30 = new ReconnectingWebSocket("ws://" + IP + ":1884/ws/OP30");
ws30.onmessage = function (e) {

    var obj = JSON.parse(e.data);
    if(typeof(robot)!='undefined'){
        robot.joints.joint_y.position.x = obj[0];
        $('#j3').html(obj[0].toFixed(2));
    }
};
